package com.aspose.cells;

import java.util.HashMap;
import java.util.Iterator;

class zbvj {
   private int a;
   private int b;
   private int c;
   private zbml d;
   private zbml e;
   private HashMap f;

   public zbvj(int var1) {
      this.a = var1;
      this.b = 0;
      this.c = 0;
      this.d = new zbml();
      this.f = new HashMap(8);
      this.f.put(zyy.a, this.d);
      this.f.put(zzk.a, new zbml());
      this.f.put(zyx.a, new zbml());
      this.f.put(zyw.a, new zbml());
      this.f.put(zzb.a, new zbml());
   }

   public boolean a() {
      return this.b >= this.a;
   }

   public int b() {
      return this.a;
   }

   public zagu a(zagu var1) {
      this.e = (zbml)this.f.get(var1);
      if (this.e != null) {
         this.c = -1;
      } else if (var1.b() == 3 && ((zyy)var1).m()) {
         this.e = this.d;
         return zyy.a;
      }

      return var1;
   }

   public void c() {
      ++this.b;
      if (this.c < 0) {
         ++this.e.a;
      } else {
         ++this.c;
      }

   }

   public void a(int var1) {
      this.b += var1;
      if (this.c < 0) {
         this.e.a += var1;
      } else {
         this.c += var1;
      }

   }

   public zagu b(zagu var1) {
      ++this.b;
      Object var2 = this.f.get(var1);
      if (var2 != null) {
         ++((zbml)var2).a;
      } else if (var1.b() == 3 && ((zyy)var1).m()) {
         ++this.d.a;
         return zyy.a;
      }

      return var1;
   }

   public int c(zagu var1) {
      Object var2 = this.f.get(var1);
      return var2 != null ? ((zbml)var2).a : 0;
   }

   public zagu d() {
      Object var1 = null;
      zbml var2;
      if (this.c < 0) {
         var2 = this.e;
      } else {
         var1 = zzk.a;
         var2 = (zbml)this.f.get(var1);
      }

      Iterator var3 = this.f.keySet().iterator();

      while(var3.hasNext()) {
         Object var4 = var3.next();
         zbml var5 = (zbml)this.f.get(var4);
         if (var5.a > var2.a) {
            var1 = (zagu)var4;
            var2 = var5;
         }
      }

      return (zagu)var1;
   }
}
